﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using FxWinSuper.Plugin.Data;

namespace FxWinSuper.Plugin.Extension
{
	/// <summary>
	/// 插件商店接口
	/// </summary>
	public interface IPluginStore
	{
		/// <summary>
		/// 获取所有插件
		/// </summary>
		/// <returns>插件列表</returns>
		Task<List<RemotePluginEntity>>  GetAllPlugins();

		/// <summary>
		/// 搜索插件
		/// </summary>
		/// <param name="pluginName">插件名</param>
		/// <returns>搜索到的插件信息</returns>
		Task<List<RemotePluginEntity>> SearchPlugin(string pluginName);

		/// <summary>
		/// 获取指定插件信息
		/// </summary>
		/// <param name="pluginName">插件名</param>
		/// <returns>插件信息</returns>
		Task<RemotePluginEntity> GetPluginInfo(string pluginName);

		/// <summary>
		/// 下载插件
		/// </summary>
		/// <param name="pluginName">插件名</param>
		/// <param name="targetFilepath">下载到的目标地址（软件自动给出，一般为zip包地址，覆盖即可）</param>
		/// <param name="ProgressCallback">下载进度回调</param>
		/// <returns>是否下载成功</returns>
		Task<bool> DownloadPlugin(string pluginName, string targetFilepath, Action<int> ProgressCallback = null);
	}
}
